var path = "";
$(function(){
	$("#login_sub").click(function(){
		login();
	});
	$("#login_ret").click(function(){
		reset();
	});
	path = $("#path").val();
});

function login(){
	Main.requestAjax("user/login",{username:$("#userName").val(),password:$("#password").val()},function(data){
		if(data.state==="success"){
			window.location.href = path + "/main/";
		}else{
			$("#login_err").text(data.msg);
		}
		
	});
}

function reset(){
	$("#userName").val("");
	$("#password").val("");
}